<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>公积金查询</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="../../plugins/mui/mui.min.css">
    <link rel="stylesheet" href="../../css/my/fund/index.css"/>
    <script src="../../js/statistics.js"></script>
    <script src="../../js/fontset.js"></script>
    <style>
    	.mui-content{
    		font-size: 15px;
    	}
    	.content-default{
    		display: flex;
    		flex-direction: column;
    		justify-content: center;
    		align-items: center;
    		height: 32vh;
    	}
    	.content-default p{
    		font-size: 15px;
    		color: #333;
    		margin: 5px 0;
    	}
    	.default-bg{
    		width: 26.67vw;
    		height: 22.8vw;
    		background-image: url(../../images/my/fund/icon-search.png);
    		background-repeat: no-repeat;
    		background-size: 100%;
    	}
    	.form-group{
    		padding:0 12px;
    		background-color: #fff;
    		font-size: 15px;
    	}
    	.form-group .group-cell{
    		position: relative;
    		display: flex;
    		justify-content: center;
    		align-items: center;
    	}
    	.form-group .group-cell:after{
    		display: block;
		    content: '';
		    position: absolute;
		    left: 0;
		    right: 0;
		    height: 1px;
		    background-color: #f0f0f0;
		    bottom: 0;
    	}
    	.form-group .group-cell:last-child:after{
    		height: 0;
    	}
    	.form-group .group-cell label{
    		min-width: 3em;
    	}
    	.form-group .group-cell input{
    		font-size: 15px;
    		margin: 0;
    		border: none;
    		border-radius: inherit;
    	}
    	.form-padded{
    		margin:16vw 4vw;
    	}
    	.form-padded button{
    		font-size: 15px;
    		padding: 10px 0;
    		border: none;
    		border-radius: 5px;
    	}
    	.form-footer p{
    		font-size: 13px;
    		text-align: center;
    		margin: 2vw 0;
    	}
    </style>
</head>
<body>
<header class="mui-bar mui-bar-nav header">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">公积金查询</h1>
</header>
<div class="mui-content">
	<div class="content-default">
		<div class="default-bg">
			
		</div>
		<p>溧阳公积金</p>
	</div>
	<div class="form-group">
		<div class="group-cell">
			<label for="user">账户：</label>
			<input type="text"  id="user" placeholder="请输入你的公积金账户/身份证号"/>
		</div>
		<div class="group-cell">
			<label for="password">密码：</label>
			<input type="password"  id="password" placeholder="请填写"/>
		</div>
	</div>
	<div class="form-padded">
		<button class="mui-btn mui-btn-block btn-primary" id="searchBtn">查询</button>
	</div>
	<div class="form-footer">
		<p>输入查询密码后，您的公积金账户将自动绑定</p>
		<p>默认密码不能绑定</p>
	</div>
	
</div>
<script type="text/javascript" src="../../plugins/jquery/jquery-3.1.0.min.js"></script>
<script src="../../plugins/mui/mui.min.js"></script>
<!--<script type="text/javascript" src="../plugins/mui/update.js"></script>-->
<script src="../../js/getApiToken.js"></script>
<script src="../../js/md5.js"></script>
<script src="../../js/my/security/index.js" ></script>
<script src="../../js/life_housekeeper/windowTitleView.js"></script>
<script type="text/javascript">
    mui.init({
// 				statusBarBackground: '#43ac45',  //ios下设置顶部背景色
    });
	mui.plusReady(function(){
		certification(getSpcode);
		//getSpcode();
	})
	function getSpcode(){
		var userId = plus.storage.getItem('cg_user_id');	
		var searchBtn = document.getElementById('searchBtn'),
			user = document.getElementById("user"),
			password = document.getElementById("password");
			searchBtn.addEventListener('tap',function(){
				if(!user.value || user.value == ''){
					mui.toast('请输入您的账户');
					return;
				}
				if(!password.value || password.value == ''){
					mui.toast('密码不能为空');
					return;
				}
				plus.nativeUI.showWaiting('',{modal:false,back:'close'});
				myAjax('home/provident/getUserInfo','post',{
					username:user.value,
					password:password.value,
					type:1
				},function(e){
					if(e.code == 0){
						
						var spcode = e.data.body.list.acc_info[0].spcode;
						myAjax('home/provident/bind','post',{
							userId:userId,
							spcode:spcode
						},function(e){
							plus.nativeUI.closeWaiting();
							if(e.code == 0){
								plus.storage.setItem('spcode',spcode);
							}
							
							var viewOptions = {
								url:'fund.html',
								id:'fund'
							},
							extras ={
								spcode:spcode
							},
							titleOptions = {
								backImg:'whiteBack'
							};
							addTitleView(viewOptions,extras,titleOptions);
						})
						
					}else{
						plus.nativeUI.closeWaiting();
							var msg = e.message;
							mui.toast(msg);
						}
					})
				},false)	
			
		
	}
	
</script>
</body>
</html>
